<%@ page language="java" contentType="text/html; charset=utf-8"
    pageEncoding="utf-8"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<!-- 加载公共的头部的样式 (jquery+bootstrap)-->
<%@ include file="/views/common/headerStyle.jsp"%> 
<title>系统跳转</title>

<style>
	.main_box{
		display: flex;
		justify-content: center;
		align-items: center;
	}

</style>
</head>
<body>


<div class="main_box">
	<h1> ${title} </h1>
	<div><span> ${msg} </span></div>
	<div><span id = "countdown"> ${(num)>0 ? num :0} </span>后跳转...</div>

</div>

</body>
<!-- 加载公共的底部的样式(jquery+bootstrap) -->
<%@ include file="/views/common/footerStyle.jsp"%> 
<script>

var flag = 0;

$(document).ready(function(){
	flag = setInterval(function(){
		num = $('#countdown').text();
		showCountdown('countdown',parseInt(num));
	}, 1000);
	
});


function showCountdown(el,num){
	num--;
	$("#"+el).text(num);
	console.log(flag);
	if(num<=0){
		clearInterval(flag);
		//跳转,有back_url则跳转,无则返回上一页
		var back_url = "${back_url}";
		if(back_url){
			window.location.href=back_url;
		}else{
			window.history.back(-1);
		}
		
		
		
	} 
}

	
	
</script>
</html>